.class final Lcom/burstly/lib/service/IpDownloader;
.super Ljava/lang/Object;
.source "IpDownloader.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/burstly/lib/service/IpDownloader$IpListCallback;
    }
.end annotation


# static fields
.field private static final EMPTY_ARRAY_LIST:Ljava/util/List; = null
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation
.end field

.field private static final LOG:Lcom/burstly/lib/util/LoggerExt; = null

.field private static final MILLISEC_IN_DAY:J = 0x5265c00L

.field private static final TAG:Ljava/lang/String; = "IpDownloader"


# instance fields
.field private mCacheFile:Ljava/io/File;

.field private mContext:Landroid/content/Context;

.field final mFileName:Ljava/lang/String;

.field private final mHostProvider:Lcom/burstly/lib/service/IHostProvider;

.field volatile mInProgress:Z

.field private final mIpList:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation
.end field

.field final mUri:Ljava/lang/String;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 46
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    sput-object v0, Lcom/burstly/lib/service/IpDownloader;->EMPTY_ARRAY_LIST:Ljava/util/List;

    .line 51
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/service/IpDownloader;->LOG:Lcom/burstly/lib/util/LoggerExt;

    return-void
.end method

.method constructor <init>(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Lcom/burstly/lib/service/IHostProvider;)V
    .locals 4
    .parameter "context"
    .parameter "fileName"
    .parameter "serverUri"
    .parameter "hostProvider"

    .prologue
    .line 145
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 146
    iput-object p2, p0, Lcom/burstly/lib/service/IpDownloader;->mFileName:Ljava/lang/String;

    .line 147
    iput-object p3, p0, Lcom/burstly/lib/service/IpDownloader;->mUri:Ljava/lang/String;

    .line 148
    iput-object p4, p0, Lcom/burstly/lib/service/IpDownloader;->mHostProvider:Lcom/burstly/lib/service/IHostProvider;

    .line 149
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/burstly/lib/service/IpDownloader;->mIpList:Ljava/util/List;

    .line 150
    if-eqz p1, :cond_0

    .line 151
    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    iput-object v0, p0, Lcom/burstly/lib/service/IpDownloader;->mContext:Landroid/content/Context;

    .line 155
    :goto_0
    return-void

    .line 153
    :cond_0
    sget-object v0, Lcom/burstly/lib/service/IpDownloader;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v1, "IpDownloader"

    const-string v2, "Can\'t run server list update with null context."

    const/4 v3, 0x0

    new-array v3, v3, [Ljava/lang/Object;

    invoke-virtual {v0, v1, v2, v3}, Lcom/burstly/lib/util/LoggerExt;->logInfo(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    goto :goto_0
.end method

.method static synthetic access$000()Lcom/burstly/lib/util/LoggerExt;
    .locals 1

    .prologue
    .line 41
    sget-object v0, Lcom/burstly/lib/service/IpDownloader;->LOG:Lcom/burstly/lib/util/LoggerExt;

    return-object v0
.end method

.method private createRequestTO()Lcom/burstly/lib/network/request/RequestManager$RequestDataObject;
    .locals 7
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Lcom/burstly/lib/network/request/RequestManager$RequestDataObject",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    .prologue
    .line 272
    new-instance v0, Lcom/burstly/lib/network/request/RequestManager$RequestDataObject;

    iget-object v1, p0, Lcom/burstly/lib/service/IpDownloader;->mUri:Ljava/lang/String;

    const/4 v2, 0x0

    const-string v3, "IP list request"

    new-instance v4, Lcom/burstly/lib/service/IpDownloader$IpListCallback;

    invoke-direct {v4, p0}, Lcom/burstly/lib/service/IpDownloader$IpListCallback;-><init>(Lcom/burstly/lib/service/IpDownloader;)V

    const-class v5, Ljava/lang/String;

    iget-object v6, p0, Lcom/burstly/lib/service/IpDownloader;->mHostProvider:Lcom/burstly/lib/service/IHostProvider;

    invoke-direct/range {v0 .. v6}, Lcom/burstly/lib/network/request/RequestManager$RequestDataObject;-><init>(Ljava/lang/String;Lcom/burstly/lib/network/beans/cookie/ICookieRequest;Ljava/lang/String;Lcom/burstly/lib/network/request/IRequestCallback;Ljava/lang/Class;Lcom/burstly/lib/service/IHostProvider;)V

    return-object v0
.end method

.method private loadIpsIfNeed()Z
    .locals 11

    .prologue
    const/4 v9, 0x1

    const/4 v5, 0x0

    .line 244
    iget-object v6, p0, Lcom/burstly/lib/service/IpDownloader;->mContext:Landroid/content/Context;

    if-nez v6, :cond_0

    move v4, v5

    .line 263
    :goto_0
    return v4

    .line 247
    :cond_0
    iget-object v6, p0, Lcom/burstly/lib/service/IpDownloader;->mContext:Landroid/content/Context;

    invoke-direct {p0, v6}, Lcom/burstly/lib/service/IpDownloader;->readCacheFile(Landroid/content/Context;)V

    .line 248
    iget-object v6, p0, Lcom/burstly/lib/service/IpDownloader;->mCacheFile:Ljava/io/File;

    if-eqz v6, :cond_1

    iget-object v6, p0, Lcom/burstly/lib/service/IpDownloader;->mCacheFile:Ljava/io/File;

    invoke-virtual {v6}, Ljava/io/File;->lastModified()J

    move-result-wide v0

    .line 249
    .local v0, creationDate:J
    :goto_1
    const-wide/32 v6, 0x5265c00

    add-long v2, v0, v6

    .line 250
    .local v2, expirationDate:J
    const/4 v4, 0x1

    .line 251
    .local v4, isActual:Z
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v6

    cmp-long v6, v6, v2

    if-lez v6, :cond_3

    .line 252
    iget-boolean v6, p0, Lcom/burstly/lib/service/IpDownloader;->mInProgress:Z

    if-nez v6, :cond_2

    .line 253
    sget-object v6, Lcom/burstly/lib/service/IpDownloader;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v7, "IpDownloader"

    const-string v8, "Ip cache file is stale. Downloading actual..."

    new-array v5, v5, [Ljava/lang/Object;

    invoke-virtual {v6, v7, v8, v5}, Lcom/burstly/lib/util/LoggerExt;->logInfo(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 254
    iput-boolean v9, p0, Lcom/burstly/lib/service/IpDownloader;->mInProgress:Z

    .line 255
    invoke-direct {p0}, Lcom/burstly/lib/service/IpDownloader;->createRequestTO()Lcom/burstly/lib/network/request/RequestManager$RequestDataObject;

    move-result-object v5

    invoke-static {v5}, Lcom/burstly/lib/network/request/RequestManager;->makeIpListRequest(Lcom/burstly/lib/network/request/RequestManager$RequestDataObject;)Lcom/burstly/lib/network/request/AbortableAsyncTask;

    .line 259
    :goto_2
    const/4 v4, 0x0

    goto :goto_0

    .line 248
    .end local v0           #creationDate:J
    .end local v2           #expirationDate:J
    .end local v4           #isActual:Z
    :cond_1
    const-wide/16 v0, 0x0

    goto :goto_1

    .line 257
    .restart local v0       #creationDate:J
    .restart local v2       #expirationDate:J
    .restart local v4       #isActual:Z
    :cond_2
    sget-object v6, Lcom/burstly/lib/service/IpDownloader;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v7, "IpDownloader"

    const-string v8, "Request of default Burslty servers is in progress..."

    new-array v5, v5, [Ljava/lang/Object;

    invoke-virtual {v6, v7, v8, v5}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    goto :goto_2

    .line 261
    :cond_3
    sget-object v6, Lcom/burstly/lib/service/IpDownloader;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v7, "IpDownloader"

    const-string v8, "Ip cache file is actual. Expiration date is: {0}"

    new-array v9, v9, [Ljava/lang/Object;

    new-instance v10, Ljava/util/Date;

    invoke-direct {v10, v2, v3}, Ljava/util/Date;-><init>(J)V

    aput-object v10, v9, v5

    invoke-virtual {v6, v7, v8, v9}, Lcom/burstly/lib/util/LoggerExt;->logInfo(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    goto :goto_0
.end method

.method private readCacheFile(Landroid/content/Context;)V
    .locals 2
    .parameter "ctxt"

    .prologue
    .line 304
    iget-object v1, p0, Lcom/burstly/lib/service/IpDownloader;->mFileName:Ljava/lang/String;

    invoke-virtual {p1, v1}, Landroid/content/Context;->getFileStreamPath(Ljava/lang/String;)Ljava/io/File;

    move-result-object v0

    .line 305
    .local v0, cache:Ljava/io/File;
    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result v1

    if-eqz v1, :cond_0

    .line 306
    iput-object v0, p0, Lcom/burstly/lib/service/IpDownloader;->mCacheFile:Ljava/io/File;

    .line 308
    :cond_0
    return-void
.end method

.method private readCachedList()Ljava/util/List;
    .locals 7
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    .prologue
    const/4 v4, 0x1

    const/4 v6, 0x0

    .line 192
    invoke-direct {p0}, Lcom/burstly/lib/service/IpDownloader;->readList()Ljava/util/List;

    move-result-object v0

    .line 193
    .local v0, list:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    invoke-interface {v0}, Ljava/util/List;->isEmpty()Z

    move-result v1

    if-nez v1, :cond_0

    .line 194
    sget-object v1, Lcom/burstly/lib/service/IpDownloader;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v2, "IpDownloader"

    const-string v3, "Retrieved {0} from cache ip file."

    new-array v4, v4, [Ljava/lang/Object;

    aput-object v0, v4, v6

    invoke-virtual {v1, v2, v3, v4}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 195
    iget-object v1, p0, Lcom/burstly/lib/service/IpDownloader;->mIpList:Ljava/util/List;

    invoke-interface {v1, v0}, Ljava/util/List;->addAll(Ljava/util/Collection;)Z

    .line 200
    :goto_0
    iget-object v1, p0, Lcom/burstly/lib/service/IpDownloader;->mIpList:Ljava/util/List;

    return-object v1

    .line 197
    :cond_0
    invoke-direct {p0}, Lcom/burstly/lib/service/IpDownloader;->loadIpsIfNeed()Z

    .line 198
    sget-object v1, Lcom/burstly/lib/service/IpDownloader;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v2, "IpDownloader"

    const-string v3, "Retrieved {0} because of stale ip file."

    new-array v4, v4, [Ljava/lang/Object;

    sget-object v5, Lcom/burstly/lib/service/IpDownloader;->EMPTY_ARRAY_LIST:Ljava/util/List;

    aput-object v5, v4, v6

    invoke-virtual {v1, v2, v3, v4}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    goto :goto_0
.end method

.method private readList()Ljava/util/List;
    .locals 9
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    .prologue
    .line 209
    const/4 v1, 0x0

    .line 210
    .local v1, fIn:Ljava/io/FileInputStream;
    const/4 v3, 0x0

    .line 212
    .local v3, isr:Ljava/io/InputStreamReader;
    :try_start_0
    iget-object v5, p0, Lcom/burstly/lib/service/IpDownloader;->mContext:Landroid/content/Context;

    if-eqz v5, :cond_3

    .line 213
    iget-object v5, p0, Lcom/burstly/lib/service/IpDownloader;->mContext:Landroid/content/Context;

    iget-object v6, p0, Lcom/burstly/lib/service/IpDownloader;->mFileName:Ljava/lang/String;

    invoke-virtual {v5, v6}, Landroid/content/Context;->openFileInput(Ljava/lang/String;)Ljava/io/FileInputStream;

    move-result-object v1

    .line 214
    new-instance v4, Ljava/io/InputStreamReader;

    invoke-direct {v4, v1}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 215
    .end local v3           #isr:Ljava/io/InputStreamReader;
    .local v4, isr:Ljava/io/InputStreamReader;
    const/16 v5, 0x400

    :try_start_1
    new-array v2, v5, [C

    .line 216
    .local v2, inputBuffer:[C
    invoke-virtual {v4, v2}, Ljava/io/InputStreamReader;->read([C)I

    .line 217
    new-instance v5, Ljava/lang/String;

    invoke-direct {v5, v2}, Ljava/lang/String;-><init>([C)V

    invoke-static {v5}, Lcom/burstly/lib/util/Utils;->fromJsonToListOfStrings(Ljava/lang/String;)Ljava/util/List;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_1

    move-result-object v5

    .line 229
    if-eqz v1, :cond_0

    .line 230
    invoke-static {v1}, Lcom/burstly/lib/util/Utils;->closeStream(Ljava/io/Closeable;)V

    .line 232
    :cond_0
    if-eqz v4, :cond_1

    .line 233
    invoke-static {v4}, Lcom/burstly/lib/util/Utils;->closeStream(Ljava/io/Closeable;)V

    :cond_1
    move-object v3, v4

    .end local v2           #inputBuffer:[C
    .end local v4           #isr:Ljava/io/InputStreamReader;
    .restart local v3       #isr:Ljava/io/InputStreamReader;
    :cond_2
    :goto_0
    return-object v5

    .line 219
    :cond_3
    :try_start_2
    sget-object v5, Lcom/burstly/lib/service/IpDownloader;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v6, "IpDownloader"

    const-string v7, "Can\'t read list of addresses with null context passed. Call updateList first!"

    const/4 v8, 0x0

    new-array v8, v8, [Ljava/lang/Object;

    invoke-virtual {v5, v6, v7, v8}, Lcom/burstly/lib/util/LoggerExt;->logInfo(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 220
    sget-object v5, Lcom/burstly/lib/service/IpDownloader;->EMPTY_ARRAY_LIST:Ljava/util/List;
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0

    .line 229
    if-eqz v1, :cond_4

    .line 230
    invoke-static {v1}, Lcom/burstly/lib/util/Utils;->closeStream(Ljava/io/Closeable;)V

    .line 232
    :cond_4
    if-eqz v3, :cond_2

    .line 233
    invoke-static {v3}, Lcom/burstly/lib/util/Utils;->closeStream(Ljava/io/Closeable;)V

    goto :goto_0

    .line 222
    :catch_0
    move-exception v0

    .line 223
    .local v0, e:Ljava/io/IOException;
    :goto_1
    :try_start_3
    sget-object v5, Lcom/burstly/lib/service/IpDownloader;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v6, "IpDownloader"

    const-string v7, "IP cache file not found. It might has not been created yet. It will be automatically created with new reuqest to Burstly server."

    const/4 v8, 0x0

    new-array v8, v8, [Ljava/lang/Object;

    invoke-virtual {v5, v6, v7, v8}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 226
    sget-object v5, Lcom/burstly/lib/service/IpDownloader;->EMPTY_ARRAY_LIST:Ljava/util/List;
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0

    .line 229
    if-eqz v1, :cond_5

    .line 230
    invoke-static {v1}, Lcom/burstly/lib/util/Utils;->closeStream(Ljava/io/Closeable;)V

    .line 232
    :cond_5
    if-eqz v3, :cond_2

    .line 233
    invoke-static {v3}, Lcom/burstly/lib/util/Utils;->closeStream(Ljava/io/Closeable;)V

    goto :goto_0

    .line 229
    .end local v0           #e:Ljava/io/IOException;
    :catchall_0
    move-exception v5

    :goto_2
    if-eqz v1, :cond_6

    .line 230
    invoke-static {v1}, Lcom/burstly/lib/util/Utils;->closeStream(Ljava/io/Closeable;)V

    .line 232
    :cond_6
    if-eqz v3, :cond_7

    .line 233
    invoke-static {v3}, Lcom/burstly/lib/util/Utils;->closeStream(Ljava/io/Closeable;)V

    :cond_7
    throw v5

    .line 229
    .end local v3           #isr:Ljava/io/InputStreamReader;
    .restart local v4       #isr:Ljava/io/InputStreamReader;
    :catchall_1
    move-exception v5

    move-object v3, v4

    .end local v4           #isr:Ljava/io/InputStreamReader;
    .restart local v3       #isr:Ljava/io/InputStreamReader;
    goto :goto_2

    .line 222
    .end local v3           #isr:Ljava/io/InputStreamReader;
    .restart local v4       #isr:Ljava/io/InputStreamReader;
    :catch_1
    move-exception v0

    move-object v3, v4

    .end local v4           #isr:Ljava/io/InputStreamReader;
    .restart local v3       #isr:Ljava/io/InputStreamReader;
    goto :goto_1
.end method


# virtual methods
.method getIpList()Ljava/util/List;
    .locals 6
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    .prologue
    const/4 v4, 0x1

    const/4 v5, 0x0

    .line 282
    sget-object v0, Lcom/burstly/lib/service/IpDownloader;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v1, "IpDownloader"

    const-string v2, "Retrieving Burslty servers..."

    new-array v3, v5, [Ljava/lang/Object;

    invoke-virtual {v0, v1, v2, v3}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 284
    iget-object v0, p0, Lcom/burstly/lib/service/IpDownloader;->mIpList:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->isEmpty()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 285
    invoke-direct {p0}, Lcom/burstly/lib/service/IpDownloader;->readCachedList()Ljava/util/List;

    move-result-object v0

    .line 295
    :goto_0
    return-object v0

    .line 288
    :cond_0
    invoke-direct {p0}, Lcom/burstly/lib/service/IpDownloader;->loadIpsIfNeed()Z

    move-result v0

    if-nez v0, :cond_1

    .line 289
    iget-object v0, p0, Lcom/burstly/lib/service/IpDownloader;->mIpList:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->clear()V

    .line 290
    sget-object v0, Lcom/burstly/lib/service/IpDownloader;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v1, "IpDownloader"

    const-string v2, "Retrieved {0} because of stale ip file."

    new-array v3, v4, [Ljava/lang/Object;

    sget-object v4, Lcom/burstly/lib/service/IpDownloader;->EMPTY_ARRAY_LIST:Ljava/util/List;

    aput-object v4, v3, v5

    invoke-virtual {v0, v1, v2, v3}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 291
    sget-object v0, Lcom/burstly/lib/service/IpDownloader;->EMPTY_ARRAY_LIST:Ljava/util/List;

    goto :goto_0

    .line 294
    :cond_1
    sget-object v0, Lcom/burstly/lib/service/IpDownloader;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v1, "IpDownloader"

    const-string v2, "Retrieved {0} from ip file cache."

    new-array v3, v4, [Ljava/lang/Object;

    iget-object v4, p0, Lcom/burstly/lib/service/IpDownloader;->mIpList:Ljava/util/List;

    aput-object v4, v3, v5

    invoke-virtual {v0, v1, v2, v3}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 295
    new-instance v0, Ljava/util/ArrayList;

    iget-object v1, p0, Lcom/burstly/lib/service/IpDownloader;->mIpList:Ljava/util/List;

    invoke-direct {v0, v1}, Ljava/util/ArrayList;-><init>(Ljava/util/Collection;)V

    goto :goto_0
.end method

.method saveIPsToFile(Ljava/lang/String;)V
    .locals 8
    .parameter "listOfServers"

    .prologue
    const/4 v7, 0x0

    .line 164
    :try_start_0
    const-string v3, ""

    invoke-virtual {p1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-nez v3, :cond_1

    const-string v3, "[]"

    invoke-virtual {p1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-nez v3, :cond_1

    .line 166
    iget-object v3, p0, Lcom/burstly/lib/service/IpDownloader;->mContext:Landroid/content/Context;

    if-eqz v3, :cond_0

    .line 167
    iget-object v3, p0, Lcom/burstly/lib/service/IpDownloader;->mContext:Landroid/content/Context;

    iget-object v4, p0, Lcom/burstly/lib/service/IpDownloader;->mFileName:Ljava/lang/String;

    const/4 v5, 0x0

    invoke-virtual {v3, v4, v5}, Landroid/content/Context;->openFileOutput(Ljava/lang/String;I)Ljava/io/FileOutputStream;

    move-result-object v1

    .line 168
    .local v1, fos:Ljava/io/FileOutputStream;
    new-instance v2, Ljava/io/OutputStreamWriter;

    invoke-direct {v2, v1}, Ljava/io/OutputStreamWriter;-><init>(Ljava/io/OutputStream;)V

    .line 169
    .local v2, osw:Ljava/io/OutputStreamWriter;
    invoke-virtual {v2, p1}, Ljava/io/OutputStreamWriter;->write(Ljava/lang/String;)V

    .line 170
    invoke-virtual {v2}, Ljava/io/OutputStreamWriter;->flush()V

    .line 171
    invoke-virtual {v2}, Ljava/io/OutputStreamWriter;->close()V

    .line 172
    iget-object v3, p0, Lcom/burstly/lib/service/IpDownloader;->mContext:Landroid/content/Context;

    iget-object v4, p0, Lcom/burstly/lib/service/IpDownloader;->mFileName:Ljava/lang/String;

    invoke-virtual {v3, v4}, Landroid/content/Context;->getFileStreamPath(Ljava/lang/String;)Ljava/io/File;

    move-result-object v3

    iput-object v3, p0, Lcom/burstly/lib/service/IpDownloader;->mCacheFile:Ljava/io/File;
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 183
    .end local v1           #fos:Ljava/io/FileOutputStream;
    .end local v2           #osw:Ljava/io/OutputStreamWriter;
    :goto_0
    iput-boolean v7, p0, Lcom/burstly/lib/service/IpDownloader;->mInProgress:Z

    .line 184
    return-void

    .line 174
    :cond_0
    :try_start_1
    sget-object v3, Lcom/burstly/lib/service/IpDownloader;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v4, "IpDownloader"

    const-string v5, "Can\'t save ip addresses with null context passed. Call updateList first!"

    const/4 v6, 0x0

    new-array v6, v6, [Ljava/lang/Object;

    invoke-virtual {v3, v4, v5, v6}, Lcom/burstly/lib/util/LoggerExt;->logInfo(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    :try_end_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_0

    .line 180
    :catch_0
    move-exception v0

    .line 181
    .local v0, e:Ljava/io/IOException;
    sget-object v3, Lcom/burstly/lib/service/IpDownloader;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v4, "IpDownloader"

    invoke-virtual {v3, v4, v0}, Lcom/burstly/lib/util/LoggerExt;->logThrowable(Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_0

    .line 177
    .end local v0           #e:Ljava/io/IOException;
    :cond_1
    :try_start_2
    sget-object v3, Lcom/burstly/lib/service/IpDownloader;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v4, "IpDownloader"

    const-string v5, "Can\'t save ip addresses because of the servers list is empty!"

    const/4 v6, 0x0

    new-array v6, v6, [Ljava/lang/Object;

    invoke-virtual {v3, v4, v5, v6}, Lcom/burstly/lib/util/LoggerExt;->logInfo(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    :try_end_2
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0

    goto :goto_0
.end method
